import { Http } from '@/network/request'
import { BankInfo, BankQuery, BankListResponse } from './data.d'

//以下皆为推测的后端接口，尚未实现

/**
 * 获取题库信息
 * @param bankId 题库ID
 * @returns 题库详情
 */
export const getBankInfo = async (bankId: string): Promise<BankInfo> => {
  try {
    const res = await Http.get<any, BankInfo>(`/admin/codeDuckQuestionCategory/getQuestionCategoryById`, {
      params: {
        id: bankId,
      },
    })
    return res.data
  } catch (err) {
    throw err
  }
}

/**
 * 获取题库列表
 * @param params 查询参数
 * @returns 题库列表
 */
export const getBankList = async (params: BankQuery): Promise<BankListResponse> => {
  try {
    const res = await Http.post<any, BankListResponse>('/question-bank/list', params)
    return res.data
  } catch (err) {
    throw err
  }
}
